package club.ljwang.controller;

import club.ljwang.service.TestService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auther: wangl
 * @Date: 2020/2/22 22:51
 * @Description:
 */


@RestController
@RequestMapping("test")

public class TestController {

    @Reference
    private TestService testService;
    @RequestMapping(value = "hello",produces = "text/plain;charset=utf-8")
    public String hello(){

        User user = (org.springframework.security.core.userdetails.User)SecurityContextHolder.getContext().getAuthentication().getPrincipal();


        return testService.hello();

    }

}
